As a bonus, prove that the nodes are visited in depth-first order